using System;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using Common.Enum;

namespace Converters
{
	public class BoolAnalysisTypeConverter : IMultiValueConverter
	{
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			if (values.Count() == 2 && values[0] != null && values[0] != DependencyProperty.UnsetValue && values[0] is EAnalysisType && values[1] != null && values[1] != DependencyProperty.UnsetValue && values[1] is bool)
			{
				if ((bool)values[1])
				{
					return false;
				}
				switch ((EAnalysisType)values[0])
				{
				case EAnalysisType.ANALYSIS_QUANTITATIVE:
					return true;
				default:
					return false;
				}
			}
			return false;
		}

		public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
		{
			return null;
		}
	}
}
